<?php

namespace App\Models\Admin;

use Illuminate\Database\Eloquent\Model;
use Storage;
use File;
use App\Services;

class ImageUpload extends Model
{
    //
    protected $file;
    public function uploadImage($file)
    {
        $this->file = $file;
        $path = public_path('uploads\portrait');
        $newFileName = date('Y-m-d',time()).'-'.rand(0,10000).'.'.$this->file->getClientOriginalExtension();
        if(!$this->file->move($path, $newFileName)){
            return ['status' => '系统异常，文件保存失败'];
        }
        return $newFileName;
    }
}
